package com.ms.service.module.analysis;

import java.math.BigDecimal;
import java.util.Date;

import com.xpec.c4.game.utility.GameUtility;

/**
 * 在快取中存放的玩家座位狀態
 */
public class PlayerSeatData {

	private PlatformType platformType;
	
	private GameNameWithHallType gameNameWithHallType;
		
	private PlayerEnterSeatStatusType playerEnterSeatStatusType;
	
	private MemberType memberType;
	
	private BigDecimal lastBet;
	
	private long lastBetTime;
	
	private String gainRateStr;
	
	//下注額有效時間(3.5分鐘)
	private static final long lastBetExpirationTime = 3*60*1000 + 30*1000;
	
	public PlatformType getPlatformType() {
		return platformType;
	}

	public void setPlatformType(PlatformType platformType) {
		this.platformType = platformType;
	}

	public GameNameWithHallType getGameNameWithHallType() {
		return gameNameWithHallType;
	}

	public void setGameNameWithHallType(GameNameWithHallType gameNameWithHallType) {
		this.gameNameWithHallType = gameNameWithHallType;
	}

	public PlayerEnterSeatStatusType getPlayerEnterSeatStatusType() {
		return playerEnterSeatStatusType;
	}

	public void setPlayerEnterSeatStatusType(
			PlayerEnterSeatStatusType playerEnterSeatStatusType) {
		this.playerEnterSeatStatusType = playerEnterSeatStatusType;
	}

	public MemberType getMemberType() {
		return memberType;
	}

	public void setMemberType(MemberType memberType) {
		this.memberType = memberType;
	}

	public BigDecimal getLastBet() {
		return lastBet;
	}

	public void setLastBet(BigDecimal lastBet) {
		this.lastBet = lastBet;
	}

	public long getLastBetTime() {
		return lastBetTime;
	}

	public void setLastBetTime(long lastBetTime) {
		this.lastBetTime = lastBetTime;
	}
	
	public String getGainRateStr() {
		return gainRateStr;
	}

	public void setGainRateStr(String gainRateStr) {
		this.gainRateStr = gainRateStr;
	}

	/**
	 * 判斷上次下注金額是否還在保存期限之內
	 */
	public boolean isLastBetEffective(){
		Date ExpirationTime = GameUtility.longToDate(lastBetTime + lastBetExpirationTime);
		if(GameUtility.getCurrentDate().before(ExpirationTime)){
			return true;
		}
		else return false;
	}
}
